<template>
  <div></div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import cannyConfig from '@/components/paint/sd/controlnetConfig/Canny.json'
import depthConfig from '@/components/paint/sd/controlnetConfig/Depth.json'
import inPaintConfig from '@/components/paint/sd/controlnetConfig/Inpaint.json'
import ipAdapterConfig from '@/components/paint/sd/controlnetConfig/IP-Adapter.json'
import lineartConfig from '@/components/paint/sd/controlnetConfig/Lineart.json'
import mlsdConfig from '@/components/paint/sd/controlnetConfig/MLSD.json'
import normalMapConfig from '@/components/paint/sd/controlnetConfig/NormalMap.json'
import openPoseConfig from '@/components/paint/sd/controlnetConfig/OpenPose.json'
import recolorConfig from '@/components/paint/sd/controlnetConfig/Recolor.json'
import referenceConfig from '@/components/paint/sd/controlnetConfig/Reference.json'
import revisionConfig from '@/components/paint/sd/controlnetConfig/Revision.json'
import scribbleSketchConfig from '@/components/paint/sd/controlnetConfig/ScribbleSketch.json'
import segementationConfig from '@/components/paint/sd/controlnetConfig/Segementation.json'
import shuffleConfig from '@/components/paint/sd/controlnetConfig/Shuffle.json'
import softEdgeConfig from '@/components/paint/sd/controlnetConfig/SoftEdge.json'
import t2iAdapterConfig from '@/components/paint/sd/controlnetConfig/T2I-Adapter.json'
import tileConfig from '@/components/paint/sd/controlnetConfig/Tile.json'



const jsonMap = ref(new Map())

onMounted(async () => {
  jsonMap.value.set('Canny', cannyConfig)
  jsonMap.value.set('Depth', depthConfig)
  jsonMap.value.set('Inpaint', inPaintConfig)
  jsonMap.value.set('IPAdapter', ipAdapterConfig)
  jsonMap.value.set('Lineart', lineartConfig)
  jsonMap.value.set('MLSD', mlsdConfig)
  jsonMap.value.set('NormalMap', normalMapConfig)
  jsonMap.value.set('OpenPose', openPoseConfig)
  jsonMap.value.set('Recolor', recolorConfig)
  jsonMap.value.set('Reference', referenceConfig)
  jsonMap.value.set('Revision', revisionConfig)
  jsonMap.value.set('ScribbleSketch', scribbleSketchConfig)
  jsonMap.value.set('Segementation', segementationConfig)
  jsonMap.value.set('Shuffle', shuffleConfig)
  jsonMap.value.set('SoftEdge', softEdgeConfig)
  jsonMap.value.set('T2IAdapter', t2iAdapterConfig)
  jsonMap.value.set('Tile', tileConfig)
})


const getConfig = (controlNetName, modelName) => {
  const controlnetJson = jsonMap.value.get(controlNetName)
  console.log(controlnetJson)
  console.log(modelName)
  for(const key in controlnetJson) {
    if(modelName === key){
      console.log(controlnetJson[key])
      return controlnetJson[key]
    }
  }

}
defineExpose({
  getConfig
})
</script>
